package com.hqd.ch03.v20.aop.framework.adapter;

import com.hqd.ch03.v20.aop.Advisor;
import com.hqd.ch03.v20.aop.ThrowsAdvice;
import com.hqd.ch03.v20.aopalliance.aop.Advice;
import com.hqd.ch03.v20.aopalliance.intercept.MethodInterceptor;

public class ThrowsAdviceAdapter implements AdvisorAdapter {

    @Override
    public boolean supportsAdvice(Advice advice) {
        return (advice instanceof ThrowsAdvice);
    }

    @Override
    public MethodInterceptor getInterceptor(Advisor advisor) {
        return new ThrowsAdviceInterceptor(advisor.getAdvice());
    }

}